<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>


 <script src="/resource/date/jquery-ui.js"></script>
 <link rel="stylesheet" href="/resource/date/jquery-ui.css"> 
 <link rel="stylesheet" href="/resource/date/style.css">
     
<form id="form" enctype="application/x-www-form-urlencoded" method="get">

  <div class="form-group row" >
    <label for="name" class="col-sm-2 col-form-label">名称</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="name" name="name">
    </div>
  </div>
  
  <div class="form-group row">
    <label for="firstChar" class="col-sm-2 col-form-label">首字母</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="firstChar" name="firstChar">
    </div>
  </div>
  
  
  <div class="form-group row">
    <label for="file" class="col-sm-2 col-form-label">图片</label>
    <div class="col-sm-10">
      <input type="file" class="form-control" id="file" name="file">
    </div>
  </div>
  
   <div class="form-group row">
    <label for="file" class="col-sm-2 col-form-label">日期</label>
    <div class="col-sm-10">
      <input type="date"  id="myDate" name="myDate">
    </div>
  </div>
  
  <div class="form-group row">
    <label for="file" class="col-sm-2 col-form-label"></label>
    <div class="col-sm-10">
      <button class="btn btn-primary mb-2" type="button" onclick="commitData()"> 提交</button>
    </div>
  </div>
  
  
</form>   
  

  
<script type="text/javascript">
   $(function(){
	  // $( "#myDate" ).datepicker();
	   //$( "#myDate" ).datepicker( "option", "dateFormat", "yy-mm-dd");
	   
	  
   })
	function commitData() {
		var formData = new FormData($("#form")[0]);
		$.ajax({
			url:"../brand/add",// 提交地址
			processData: false, //   application/x-www-form-urlencoded
			type:"post", // 
			contentType:false,// application/x-www-form-urlencoded
			data:formData,
			dataType:"json",  // 返回结果的数据格式
			success:function(data){
				//alert(data.code)
				$("#workContent").load("../brand/list")
			}
		})
	}

</script> 